{extend name="Layout/edit" /}
{block name="content"}
<!-- form start -->
<form action="{:U('editSave')}" method="post" class="form-horizontal">
    <div class="box-body">
        <div class="form-group">
            <label class="col-sm-2 control-label">标题</label>
            <div class="col-sm-10">
                <input type="text" name="title" class="form-control input-sm" placeholder="标题" value="{$data.title}" required="required" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">smtp服务器</label>
            <div class="col-sm-10">
                <div class="btn-group btn-group-justified">
                    <div class="btn-group" style="width:60%">
                        <div class="input-group">
                            <span class="input-group-addon">服务器</span>
                            <input type="text" name="host" class="form-control input-sm" placeholder="smtp服务器" value="{$data.host}" required="required" />
                        </div>
                    </div>
                    <div class="btn-group" style="width:40%">
                        <div class="input-group">
                            <span class="input-group-addon">端口号</span>
                            <input type="number" name="port" class="form-control input-sm" placeholder="smtp端口号" value="{$data.port|default=25}" required="required" />
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">smtp账户</label>
            <div class="col-sm-10">
                <div class="btn-group btn-group-justified">
                    <div class="btn-group">
                        <div class="input-group">
                            <span class="input-group-addon">帐号</span>
                            <input type="text" name="login_id" class="form-control input-sm" placeholder="smtp帐号" value="{$data.login_id}" required="required" />
                        </div>
                    </div>
                    <div class="btn-group">
                        <div class="input-group">
                            <span class="input-group-addon">密码</span>
                            <span class="xsui-password-input"><input type="password" name="password" class="form-control input-sm" placeholder="smtp密码" required="required" value="{$data.password}" /></span>
                            <span class="input-group-btn">
                                <button class="btn btn-default btn-sm xsui-btn-show-password" type="button" title="显示密码"><span class="glyphicon glyphicon-eye-open"></span></button>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">发信设置</label>
            <div class="col-sm-10">
                <div class="btn-group btn-group-justified">
                    <div class="btn-group" style="width:60%">
                        <div class="input-group">
                            <span class="input-group-addon">发信邮箱</span>
                            <input type="text" name="from_address" class="form-control input-sm" placeholder="发信邮箱" value="{$data.from_address}" required="required" />
                        </div>
                    </div>
                    <div class="btn-group" style="width:40%">
                        <div class="input-group">
                            <span class="input-group-addon">发信人</span>
                            <input type="text" name="from_name" class="form-control input-sm" placeholder="发信人" value="{$data.from_name}" required="required" />
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">每日限额</label>                        
            <div class="col-sm-10">
                <input type="number" name="day_count" class="form-control input-sm" placeholder="每日限额" value="{$data.day_count|default=0}" required="required" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">是否加密</label>                        
            <div class="col-sm-10">
                {xshtml:radio name="secure" data="array(''=>'不加密','SSL'=>'SSL','TLS'=>'TLS')" value="data.secure|default=''" /}
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">备注</label>                        
            <div class="col-sm-10">
                <input type="text" name="remark" class="form-control input-sm" placeholder="备注" value="{$data.remark}" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">状态</label>
            <div class="col-sm-10">
                {xshtml:radio name="status" data='array("1"=>"显示","0"=>"隐藏")' value="data['status']|default='1'" /}
            </div>
        </div>
    </div>
    <!-- /.box-body -->
    <div class="box-footer">
        <button type="button" class="btn btn-default xsui-btn-close-dialog">取消</button>
        <button type="submit" class="btn btn-primary pull-right">保存</button>
        <input type="hidden" name="id" value="{$data.id}"/>
    </div>
    <!-- /.box-footer -->
</form>
{/block}
{block name="script_after"}
<script>
    // 显示隐藏密码 2017-3-15
    $('.xsui-btn-show-password').mousedown(function () {
        var value = $('.xsui-password-input').find('input').val();
        $('.xsui-password-input').html('<input type="text" name="password" class="form-control input-sm" placeholder="密码" required="required" value="' + value + '" />');
    }).mouseup(function () {
        var value = $('.xsui-password-input').find('input').val();
        $('.xsui-password-input').html('<input type="password" name="password" class="form-control input-sm" placeholder="密码" required="required" value="' + value + '" />');
    })
</script>
{/block}